'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;
  router.get('/', controller.home.index);
  // 用户
  router.post('/users/login', controller.user.login); // 用户登录
  router.post('/users/create', controller.user.create); // 添加新的用户
  router.get('/users/findname', controller.user.findname); // 通过姓名查找
  router.put('/users/update', controller.user.update); // 修改信息
  router.delete('/users/delete', controller.user.delete); // 注销用户
  router.get('/users/findall', controller.user.findall); // 查询所有用户


  // 图书
  router.post('/books/create', controller.book.create); // 添加图书
  router.get('/books/show', controller.book.show); // 图书展示
  router.get('/books/findname', controller.book.findname); // 查找书
  router.get('/books/findintrest', controller.book.findintrest); // 查找
  router.delete('/books/delete', controller.book.delete); // 根据书名删除书
  router.put('/books/update', controller.book.update); // 修改图书信息
  // 借阅
  router.put('/books/borrow', controller.book.borrow); // 借书
  router.put('/books/return', controller.book.return); // 还书

  router.post('/borrow/create', controller.borrow.create); // 借书
  router.get('/borrow/find', controller.borrow.findborrow); // 根据姓名查询借书
  router.get('/borrow/findname', controller.borrow.findname); // ////借图书展示
  router.delete('/borrow/return', controller.borrow.delete); // 归还图书
  router.get('/borrow/f', controller.borrow.f);// 根据id查

};
